<?php

/**
 * Created by Reliese Model.
 */

namespace App\Models\Common;

use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
use Encore\Admin\Traits\AdminBuilder;
use Encore\Admin\Traits\ModelTree;
/**
 * Class Area
 *
 * @property int $id
 * @property string $code
 * @property string $pcode
 * @property string $text
 * @property int $sort
 * @property Carbon $created_at
 * @property Carbon $updated_at
 *
 * @package App\Models
 */
class Area extends Model
{

	protected $table = 'areas';
    protected $primaryKey = 'code';
	protected $casts = [
		'sort' => 'int',
        'code'=> 'int',
        'pcode'=> 'int',
	];

	protected $fillable = [
		'code',
		'pcode',
		'text',
		'sort'
	];

    use ModelTree, AdminBuilder;
    public function __construct(array $attributes = [])
    {
        parent::__construct($attributes);
        $this->setParentColumn('pcode');
        $this->setOrderColumn('sort');
        $this->setTitleColumn('text');
    }

}
